\(\int \frac {(e+f x)^n}{x^2 (a+b x+c x^2)} \, dx\) [547]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [F]
   Fricas [F]
   Sympy [F(-1)]
   Maxima [F]
   Giac [F]
   Mupad [F(-1)]

Optimal result

Integrand size = 23, antiderivative size = 296 \[ \int \frac {(e+f x)^n}{x^2 \left (a+b x+c x^2\right )} \, dx=-\frac {c \left (b+\frac {b^2-2 a c}{\sqrt {b^2-4 a c}}\right ) (e+f x)^{1+n} \operatorname {Hypergeometric2F1}\left (1,1+n,2+n,\frac {2 c (e+f x)}{2 c e-\left (b-\sqrt {b^2-4 a c}\right ) f}\right )}{a^2 \left (2 c e-\left (b-\sqrt {b^2-4 a c}\right ) f\right ) (1+n)}-\frac {c \left (b-\frac {b^2-2 a c}{\sqrt {b^2-4 a c}}\right ) (e+f x)^{1+n} \operatorname {Hypergeometric2F1}\left (1,1+n,2+n,\frac {2 c (e+f x)}{2 c e-\left (b+\sqrt {b^2-4 a c}\right ) f}\right )}{a^2 \left (2 c e-\left (b+\sqrt {b^2-4 a c}\right ) f\right ) (1+n)}+\frac {b (e+f x)^{1+n} \operatorname {Hypergeometric2F1}\left (1,1+n,2+n,1+\frac {f x}{e}\right )}{a^2 e (1+n)}+\frac {f (e+f x)^{1+n} \operatorname {Hypergeometric2F1}\left (2,1+n,2+n,1+\frac {f x}{e}\right )}{a e^2 (1+n)} \]

[Out]

b*(f*x+e)^(1+n)*hypergeom([1, 1+n],[2+n],1+f*x/e)/a^2/e/(1+n)+f*(f*x+e)^(1+n)*hypergeom([2, 1+n],[2+n],1+f*x/e
)/a/e^2/(1+n)-c*(f*x+e)^(1+n)*hypergeom([1, 1+n],[2+n],2*c*(f*x+e)/(2*c*e-f*(b-(-4*a*c+b^2)^(1/2))))*(b+(-2*a*
c+b^2)/(-4*a*c+b^2)^(1/2))/a^2/(1+n)/(2*c*e-f*(b-(-4*a*c+b^2)^(1/2)))-c*(f*x+e)^(1+n)*hypergeom([1, 1+n],[2+n]
,2*c*(f*x+e)/(2*c*e-f*(b+(-4*a*c+b^2)^(1/2))))*(b+(2*a*c-b^2)/(-4*a*c+b^2)^(1/2))/a^2/(1+n)/(2*c*e-f*(b+(-4*a*
c+b^2)^(1/2)))

Rubi [A] (verified)

Time = 0.31 (sec) , antiderivative size = 296, normalized size of antiderivative = 1.00, number of steps used = 8, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.174, Rules used = {974, 67, 844, 70} \[ \int \frac {(e+f x)^n}{x^2 \left (a+b x+c x^2\right )} \, dx=-\frac {c \left (\frac {b^2-2 a c}{\sqrt {b^2-4 a c}}+b\right ) (e+f x)^{n+1} \operatorname {Hypergeometric2F1}\left (1,n+1,n+2,\frac {2 c (e+f x)}{2 c e-\left (b-\sqrt {b^2-4 a c}\right ) f}\right )}{a^2 (n+1) \left (2 c e-f \left (b-\sqrt {b^2-4 a c}\right )\right )}-\frac {c \left (b-\frac {b^2-2 a c}{\sqrt {b^2-4 a c}}\right ) (e+f x)^{n+1} \operatorname {Hypergeometric2F1}\left (1,n+1,n+2,\frac {2 c (e+f x)}{2 c e-\left (b+\sqrt {b^2-4 a c}\right ) f}\right )}{a^2 (n+1) \left (2 c e-f \left (\sqrt {b^2-4 a c}+b\right )\right )}+\frac {b (e+f x)^{n+1} \operatorname {Hypergeometric2F1}\left (1,n+1,n+2,\frac {f x}{e}+1\right )}{a^2 e (n+1)}+\frac {f (e+f x)^{n+1} \operatorname {Hypergeometric2F1}\left (2,n+1,n+2,\frac {f x}{e}+1\right )}{a e^2 (n+1)} \]

[In]

Int[(e + f*x)^n/(x^2*(a + b*x + c*x^2)),x]

[Out]

-((c*(b + (b^2 - 2*a*c)/Sqrt[b^2 - 4*a*c])*(e + f*x)^(1 + n)*Hypergeometric2F1[1, 1 + n, 2 + n, (2*c*(e + f*x)
)/(2*c*e - (b - Sqrt[b^2 - 4*a*c])*f)])/(a^2*(2*c*e - (b - Sqrt[b^2 - 4*a*c])*f)*(1 + n))) - (c*(b - (b^2 - 2*
a*c)/Sqrt[b^2 - 4*a*c])*(e + f*x)^(1 + n)*Hypergeometric2F1[1, 1 + n, 2 + n, (2*c*(e + f*x))/(2*c*e - (b + Sqr
t[b^2 - 4*a*c])*f)])/(a^2*(2*c*e - (b + Sqrt[b^2 - 4*a*c])*f)*(1 + n)) + (b*(e + f*x)^(1 + n)*Hypergeometric2F
1[1, 1 + n, 2 + n, 1 + (f*x)/e])/(a^2*e*(1 + n)) + (f*(e + f*x)^(1 + n)*Hypergeometric2F1[2, 1 + n, 2 + n, 1 +
 (f*x)/e])/(a*e^2*(1 + n))

Rule 67

Int[((b_.)*(x_))^(m_)*((c_) + (d_.)*(x_))^(n_), x_Symbol] :> Simp[((c + d*x)^(n + 1)/(d*(n + 1)*(-d/(b*c))^m))
*Hypergeometric2F1[-m, n + 1, n + 2, 1 + d*(x/c)], x] /; FreeQ[{b, c, d, m, n}, x] &&  !IntegerQ[n] && (Intege
rQ[m] || GtQ[-d/(b*c), 0])

Rule 70

Int[((a_) + (b_.)*(x_))^(m_)*((c_) + (d_.)*(x_))^(n_), x_Symbol] :> Simp[(b*c - a*d)^n*((a + b*x)^(m + 1)/(b^(
n + 1)*(m + 1)))*Hypergeometric2F1[-n, m + 1, m + 2, (-d)*((a + b*x)/(b*c - a*d))], x] /; FreeQ[{a, b, c, d, m
}, x] && NeQ[b*c - a*d, 0] &&  !IntegerQ[m] && IntegerQ[n]

Rule 844

Int[(((d_.) + (e_.)*(x_))^(m_)*((f_.) + (g_.)*(x_)))/((a_.) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> Int[Exp
andIntegrand[(d + e*x)^m, (f + g*x)/(a + b*x + c*x^2), x], x] /; FreeQ[{a, b, c, d, e, f, g}, x] && NeQ[b^2 -
4*a*c, 0] && NeQ[c*d^2 - b*d*e + a*e^2, 0] &&  !RationalQ[m]

Rule 974

Int[((d_.) + (e_.)*(x_))^(m_)*((f_.) + (g_.)*(x_))^(n_)*((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(p_.), x_Symbol] :
> Int[ExpandIntegrand[(d + e*x)^m*(f + g*x)^n*(a + b*x + c*x^2)^p, x], x] /; FreeQ[{a, b, c, d, e, f, g}, x] &
& NeQ[e*f - d*g, 0] && NeQ[b^2 - 4*a*c, 0] && NeQ[c*d^2 - b*d*e + a*e^2, 0] && (IntegerQ[p] || (ILtQ[m, 0] &&
ILtQ[n, 0])) &&  !(IGtQ[m, 0] || IGtQ[n, 0])

Rubi steps \begin{align*} \text {integral}& = \int \left (\frac {(e+f x)^n}{a x^2}-\frac {b (e+f x)^n}{a^2 x}+\frac {\left (b^2-a c+b c x\right ) (e+f x)^n}{a^2 \left (a+b x+c x^2\right )}\right ) \, dx \\ & = \frac {\int \frac {\left (b^2-a c+b c x\right ) (e+f x)^n}{a+b x+c x^2} \, dx}{a^2}+\frac {\int \frac {(e+f x)^n}{x^2} \, dx}{a}-\frac {b \int \frac {(e+f x)^n}{x} \, dx}{a^2} \\ & = \frac {b (e+f x)^{1+n} \, _2F_1\left (1,1+n;2+n;1+\frac {f x}{e}\right )}{a^2 e (1+n)}+\frac {f (e+f x)^{1+n} \, _2F_1\left (2,1+n;2+n;1+\frac {f x}{e}\right )}{a e^2 (1+n)}+\frac {\int \left (\frac {\left (b c+\frac {c \left (b^2-2 a c\right )}{\sqrt {b^2-4 a c}}\right ) (e+f x)^n}{b-\sqrt {b^2-4 a c}+2 c x}+\frac {\left (b c-\frac {c \left (b^2-2 a c\right )}{\sqrt {b^2-4 a c}}\right ) (e+f x)^n}{b+\sqrt {b^2-4 a c}+2 c x}\right ) \, dx}{a^2} \\ & = \frac {b (e+f x)^{1+n} \, _2F_1\left (1,1+n;2+n;1+\frac {f x}{e}\right )}{a^2 e (1+n)}+\frac {f (e+f x)^{1+n} \, _2F_1\left (2,1+n;2+n;1+\frac {f x}{e}\right )}{a e^2 (1+n)}+\frac {\left (c \left (b-\frac {b^2-2 a c}{\sqrt {b^2-4 a c}}\right )\right ) \int \frac {(e+f x)^n}{b+\sqrt {b^2-4 a c}+2 c x} \, dx}{a^2}+\frac {\left (c \left (b+\frac {b^2-2 a c}{\sqrt {b^2-4 a c}}\right )\right ) \int \frac {(e+f x)^n}{b-\sqrt {b^2-4 a c}+2 c x} \, dx}{a^2} \\ & = -\frac {c \left (b+\frac {b^2-2 a c}{\sqrt {b^2-4 a c}}\right ) (e+f x)^{1+n} \, _2F_1\left (1,1+n;2+n;\frac {2 c (e+f x)}{2 c e-\left (b-\sqrt {b^2-4 a c}\right ) f}\right )}{a^2 \left (2 c e-\left (b-\sqrt {b^2-4 a c}\right ) f\right ) (1+n)}-\frac {c \left (b-\frac {b^2-2 a c}{\sqrt {b^2-4 a c}}\right ) (e+f x)^{1+n} \, _2F_1\left (1,1+n;2+n;\frac {2 c (e+f x)}{2 c e-\left (b+\sqrt {b^2-4 a c}\right ) f}\right )}{a^2 \left (2 c e-\left (b+\sqrt {b^2-4 a c}\right ) f\right ) (1+n)}+\frac {b (e+f x)^{1+n} \, _2F_1\left (1,1+n;2+n;1+\frac {f x}{e}\right )}{a^2 e (1+n)}+\frac {f (e+f x)^{1+n} \, _2F_1\left (2,1+n;2+n;1+\frac {f x}{e}\right )}{a e^2 (1+n)} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.40 (sec) , antiderivative size = 246, normalized size of antiderivative = 0.83 \[ \int \frac {(e+f x)^n}{x^2 \left (a+b x+c x^2\right )} \, dx=\frac {(e+f x)^{1+n} \left (-\frac {c \left (b+\frac {b^2-2 a c}{\sqrt {b^2-4 a c}}\right ) \operatorname {Hypergeometric2F1}\left (1,1+n,2+n,\frac {2 c (e+f x)}{2 c e+\left (-b+\sqrt {b^2-4 a c}\right ) f}\right )}{2 c e+\left (-b+\sqrt {b^2-4 a c}\right ) f}-\frac {c \left (b+\frac {-b^2+2 a c}{\sqrt {b^2-4 a c}}\right ) \operatorname {Hypergeometric2F1}\left (1,1+n,2+n,\frac {2 c (e+f x)}{2 c e-\left (b+\sqrt {b^2-4 a c}\right ) f}\right )}{2 c e-\left (b+\sqrt {b^2-4 a c}\right ) f}+\frac {b \operatorname {Hypergeometric2F1}\left (1,1+n,2+n,1+\frac {f x}{e}\right )}{e}+\frac {a f \operatorname {Hypergeometric2F1}\left (2,1+n,2+n,1+\frac {f x}{e}\right )}{e^2}\right )}{a^2 (1+n)} \]

[In]

Integrate[(e + f*x)^n/(x^2*(a + b*x + c*x^2)),x]

[Out]

((e + f*x)^(1 + n)*(-((c*(b + (b^2 - 2*a*c)/Sqrt[b^2 - 4*a*c])*Hypergeometric2F1[1, 1 + n, 2 + n, (2*c*(e + f*
x))/(2*c*e + (-b + Sqrt[b^2 - 4*a*c])*f)])/(2*c*e + (-b + Sqrt[b^2 - 4*a*c])*f)) - (c*(b + (-b^2 + 2*a*c)/Sqrt
[b^2 - 4*a*c])*Hypergeometric2F1[1, 1 + n, 2 + n, (2*c*(e + f*x))/(2*c*e - (b + Sqrt[b^2 - 4*a*c])*f)])/(2*c*e
 - (b + Sqrt[b^2 - 4*a*c])*f) + (b*Hypergeometric2F1[1, 1 + n, 2 + n, 1 + (f*x)/e])/e + (a*f*Hypergeometric2F1
[2, 1 + n, 2 + n, 1 + (f*x)/e])/e^2))/(a^2*(1 + n))

Maple [F]

\[\int \frac {\left (f x +e \right )^{n}}{x^{2} \left (c \,x^{2}+b x +a \right )}d x\]

[In]

int((f*x+e)^n/x^2/(c*x^2+b*x+a),x)

[Out]

int((f*x+e)^n/x^2/(c*x^2+b*x+a),x)

Fricas [F]

\[ \int \frac {(e+f x)^n}{x^2 \left (a+b x+c x^2\right )} \, dx=\int { \frac {{\left (f x + e\right )}^{n}}{{\left (c x^{2} + b x + a\right )} x^{2}} \,d x } \]

[In]

integrate((f*x+e)^n/x^2/(c*x^2+b*x+a),x, algorithm="fricas")

[Out]

integral((f*x + e)^n/(c*x^4 + b*x^3 + a*x^2), x)

Sympy [F(-1)]

Timed out. \[ \int \frac {(e+f x)^n}{x^2 \left (a+b x+c x^2\right )} \, dx=\text {Timed out} \]

[In]

integrate((f*x+e)**n/x**2/(c*x**2+b*x+a),x)

[Out]

Timed out

Maxima [F]

\[ \int \frac {(e+f x)^n}{x^2 \left (a+b x+c x^2\right )} \, dx=\int { \frac {{\left (f x + e\right )}^{n}}{{\left (c x^{2} + b x + a\right )} x^{2}} \,d x } \]

[In]

integrate((f*x+e)^n/x^2/(c*x^2+b*x+a),x, algorithm="maxima")

[Out]

integrate((f*x + e)^n/((c*x^2 + b*x + a)*x^2), x)

Giac [F]

\[ \int \frac {(e+f x)^n}{x^2 \left (a+b x+c x^2\right )} \, dx=\int { \frac {{\left (f x + e\right )}^{n}}{{\left (c x^{2} + b x + a\right )} x^{2}} \,d x } \]

[In]

integrate((f*x+e)^n/x^2/(c*x^2+b*x+a),x, algorithm="giac")

[Out]

integrate((f*x + e)^n/((c*x^2 + b*x + a)*x^2), x)

Mupad [F(-1)]

Timed out. \[ \int \frac {(e+f x)^n}{x^2 \left (a+b x+c x^2\right )} \, dx=\int \frac {{\left (e+f\,x\right )}^n}{x^2\,\left (c\,x^2+b\,x+a\right )} \,d x \]

[In]

int((e + f*x)^n/(x^2*(a + b*x + c*x^2)),x)

[Out]

int((e + f*x)^n/(x^2*(a + b*x + c*x^2)), x)